package com.u2b.servlet;

import java.io.IOException;
import java.util.HashMap;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.u2b.dispatcher.StatusDispatcher;
import com.u2b.dispatcher.UserDispatcher;
import com.u2b.global.utils.Constants;
import com.u2b.servlet.utils.ParameterParser;
import com.u2b.servlet.utils.SendToClient;
import com.u2b.servlet.utils.UrlInterceptor;

/*
 *    /status/add
 *    /status/comment
 *    /status/list_status
 *    /status/list_comments
 */
public class StatusAction extends HttpServlet
{
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse resp) throws ServletException, IOException
    {
    	SendToClient sendToClient = new SendToClient();
        String action = UrlInterceptor.intercept(request);
        ParameterParser ppr = new ParameterParser();
      
        StatusDispatcher statusDispatcher = new StatusDispatcher();
        HashMap<String, Object> initValues = ppr.initFormRequest(request);
        Object obj = statusDispatcher.dispatcer(action, initValues, request);
        sendToClient.sendMessage(request, resp, obj);

    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
    {
        doPost(req, resp);
    }
}
